package edu.hnu.tradeserver.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;

/**
 *
 * @TableName transaction
 */
@TableName(value ="transaction")
@Data
public class Transaction implements Serializable {
    /**
     *
     */
    @TableId(value = "transaction_id", type = IdType.AUTO)
    private Integer transactionId;

    /**
     *
     */
    @TableField(value = "trader_id")
    private Integer traderId;

    /**
     *
     */
    @TableField(value = "stock_id")
    private Integer stockId;

    /**
     *
     */
    @TableField(value = "transaction_type")
    private String transactionType;

    /**
     *
     */
    @TableField(value = "transaction_date")
    private Date transactionDate;

    /**
     *
     */
    @TableField(value = "transaction_quantity")
    private String transactionQuantity;

    /**
     *
     */
    @TableField(value = "transaction_price")
    private BigDecimal transactionPrice;

    /**
     *
     */
    @TableField(value = "transaction_client_name")
    private String transactionClientName;

    /**
     *
     */
    @TableField(value = "transaction_ticker")
    private String transactionTicker;

    /**
     *
     */
    @TableField(value = "transaction_ric")
    private String transactionRic;

    /**
     *
     */
    @TableField(value = "transaction_currency")
    private BigDecimal transactionCurrency;

    /**
     *
     */
    @TableField(value = "transaction_issuer_sector")
    private String transactionIssuerSector;

    /**
     *
     */
    @TableField(value = "transaction_ht_pt")
    private String transactionHtPt;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Transaction other = (Transaction) that;
        return (this.getTransactionId() == null ? other.getTransactionId() == null : this.getTransactionId().equals(other.getTransactionId()))
            && (this.getTraderId() == null ? other.getTraderId() == null : this.getTraderId().equals(other.getTraderId()))
            && (this.getStockId() == null ? other.getStockId() == null : this.getStockId().equals(other.getStockId()))
            && (this.getTransactionType() == null ? other.getTransactionType() == null : this.getTransactionType().equals(other.getTransactionType()))
            && (this.getTransactionDate() == null ? other.getTransactionDate() == null : this.getTransactionDate().equals(other.getTransactionDate()))
            && (this.getTransactionQuantity() == null ? other.getTransactionQuantity() == null : this.getTransactionQuantity().equals(other.getTransactionQuantity()))
            && (this.getTransactionPrice() == null ? other.getTransactionPrice() == null : this.getTransactionPrice().equals(other.getTransactionPrice()))
            && (this.getTransactionClientName() == null ? other.getTransactionClientName() == null : this.getTransactionClientName().equals(other.getTransactionClientName()))
            && (this.getTransactionTicker() == null ? other.getTransactionTicker() == null : this.getTransactionTicker().equals(other.getTransactionTicker()))
            && (this.getTransactionRic() == null ? other.getTransactionRic() == null : this.getTransactionRic().equals(other.getTransactionRic()))
            && (this.getTransactionCurrency() == null ? other.getTransactionCurrency() == null : this.getTransactionCurrency().equals(other.getTransactionCurrency()))
            && (this.getTransactionIssuerSector() == null ? other.getTransactionIssuerSector() == null : this.getTransactionIssuerSector().equals(other.getTransactionIssuerSector()))
            && (this.getTransactionHtPt() == null ? other.getTransactionHtPt() == null : this.getTransactionHtPt().equals(other.getTransactionHtPt()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getTransactionId() == null) ? 0 : getTransactionId().hashCode());
        result = prime * result + ((getTraderId() == null) ? 0 : getTraderId().hashCode());
        result = prime * result + ((getStockId() == null) ? 0 : getStockId().hashCode());
        result = prime * result + ((getTransactionType() == null) ? 0 : getTransactionType().hashCode());
        result = prime * result + ((getTransactionDate() == null) ? 0 : getTransactionDate().hashCode());
        result = prime * result + ((getTransactionQuantity() == null) ? 0 : getTransactionQuantity().hashCode());
        result = prime * result + ((getTransactionPrice() == null) ? 0 : getTransactionPrice().hashCode());
        result = prime * result + ((getTransactionClientName() == null) ? 0 : getTransactionClientName().hashCode());
        result = prime * result + ((getTransactionTicker() == null) ? 0 : getTransactionTicker().hashCode());
        result = prime * result + ((getTransactionRic() == null) ? 0 : getTransactionRic().hashCode());
        result = prime * result + ((getTransactionCurrency() == null) ? 0 : getTransactionCurrency().hashCode());
        result = prime * result + ((getTransactionIssuerSector() == null) ? 0 : getTransactionIssuerSector().hashCode());
        result = prime * result + ((getTransactionHtPt() == null) ? 0 : getTransactionHtPt().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", transactionId=").append(transactionId);
        sb.append(", traderId=").append(traderId);
        sb.append(", stockId=").append(stockId);
        sb.append(", transactionType=").append(transactionType);
        sb.append(", transactionDate=").append(transactionDate);
        sb.append(", transactionQuantity=").append(transactionQuantity);
        sb.append(", transactionPrice=").append(transactionPrice);
        sb.append(", transactionClientName=").append(transactionClientName);
        sb.append(", transactionTicker=").append(transactionTicker);
        sb.append(", transactionRic=").append(transactionRic);
        sb.append(", transactionCurrency=").append(transactionCurrency);
        sb.append(", transactionIssuerSector=").append(transactionIssuerSector);
        sb.append(", transactionHtPt=").append(transactionHtPt);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}
